<?php
	class Setting extends Application{
		function __construct(){
            if(!isset($_SESSION['loginadmin'])){
                header("location: ?model=login");
            }
			$this->loadModel('model_setting');
		}
		
		function index(){
			$artigos = 'sad';
			$data['artigos'] = $artigos;
			$this->loadView(TEMPLATE_ADMIN.'/index_body', $data);
		}
        function add(){
            $data['modellist'] = $this->model_setting->modellist();
            $this->loadView(TEMPLATE_ADMIN.'/index_body', $data);
        }
		function submitadd(){
            if(isset($_POST['btnaddmodel'])){
                $modelname  = isset($_POST['modelname']) ? htmlspecialchars($_POST['modelname']) : '';
                $modelload  = isset($_POST['modelload']) ? $_POST['modelload'] : '';  
                $this->model_setting->insertModel($modelname, $modelload);
                header("location: ?model=setting");
            }
		}
	}
?>